package com.hns.can.master.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hns.can.base.entity.SysParamInfoEntity;
import com.hns.can.base.entity.SysUserEntity;
import com.hns.can.common.web.BaseController;
import com.hns.can.master.service.SeverityService;

/**
 * 严重度设置 - 控制类
 * @author:lan
 * @email:763836737@qq.com
 * @version Revision 2.0.0
 */

@Controller
@RequestMapping("/severity")
public class SeverityController extends BaseController {
    
    @Autowired
    private SeverityService severityService; // 注入severityService
    
    /**
     * 严重度设置 - 获取该组织机构下的严重度设置信息，如果没有的话显示为默认的信息
     * @param corpId
     * @param organId
     * @return
     * @throws Exception
     * @author:lan
     * @email:763836737@qq.com
     */

    @RequestMapping("/searchSeverityInfo")
    @ResponseBody
    public Object searchSeverityInfo(String corpId, String organId) throws Exception {
        Map<String, Object> paraMap = new HashMap<String, Object>();
        paraMap.put("organId", organId);
        paraMap.put("corpId", corpId);
        List<SysParamInfoEntity> list = severityService.searchSeverityInfo(paraMap);
        return this.getReturnResult(list);
    }
    
    /**
     * 严重度设置 - 修改严重度信息
     * @param corpId
     * @param seleOrganId
     * @param currOrganId
     * @param paramIds
     * @param paramValues
     * @param paramValue2s
     * @return
     * @throws Exception
     * @author:lan
     * @email:763836737@qq.com
     */
    @RequestMapping("/uptSeverityInfo")
    @ResponseBody   
    public Object uptSeverityInfo(String corpId,String seleOrganId, String currOrganId, 
        String[] paramIds, String[] paramValues, String[] paramValue2s) throws Exception {
        SysUserEntity user = this.getCurrentUser().getUser();
        severityService.uptSeverityInfo(user,corpId, seleOrganId, currOrganId, paramIds, paramValues, paramValue2s);
        return getReturnResult();
    }
    
}
